import GraphView from "./graphview";
import GraphBase from "./shape/graphBase";
export class GraphDataModel {
  dataMap = new Map();
  index = 0;
  graphview: GraphView;
  constructor(graphview: GraphView) {
    this.graphview = graphview;
  }
  add(node: GraphBase) {
    this.index++;
    node.setId(this.index);
    node.setCtx(this.graphview.getCtx());
    this.dataMap.set(node.getTag(), node);
  }
  each(callback: Function) {
    this.dataMap.forEach((data) => {
      callback(data);
    });
  }
}
